<?php
/***********************************************************************
 * @package    IvanEngine
 * @subpackage Core
 * @author     Ivan <ivanzx@msn.com>
 * @created    2010-06-21
 ***********************************************************************/
if(defined("IVANENGINE_FRAMEWORK_MODIFIER"))
    die("Redefinition macro in :".__FILE__."(".__LINE__.")");
define("IVANENGINE_FRAMEWORK_MODIFIER", true);

require_once (dirname(__FILE__).'/Common.php');
require_once (dirname(__FILE__).'/Event/Event.php');

abstract class CModifier extends CEvent
{
    const EVT_EXEC_PRE  = 'EVT_EXEC_PRE';
    const EVT_EXEC_POST = 'EVT_EXEC_POST';
    public function __construct()
    {
        parent::__construct();
        $this->AddEvent(self::EVT_EXEC_PRE);
        $this->AddEvent(self::EVT_EXEC_POST);
    }
    
    public function __destruct()
    {
        parent::__destruct();
    }
    
    abstract protected function _DoExecute();
    
    public function Execute()
    {
        $evtArgs    = new CEventArgs();
        $evtArgs->object    = $this;
        $this->FireEvent(self::EVT_EXEC_PRE, $evtArgs);
        
        $this->_DoExecute();
        
        $this->FireEvent(self::EVT_EXEC_POST, $evtArgs);
    }
}
?>
